<!doctype html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>待审核账单 - 智能水表抄表系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="/static/styles/main.css">
</head>

<body>
    <header class="header">
        <h1><i class="fas fa-tint"></i> 智能水表抄表系统</h1>
    </header>

    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-light bg-light shadow-sm">
        <div class="container">
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="/"><i class="fas fa-home"></i> 首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/history"><i class="fas fa-history"></i> 历史记录</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/bills"><i class="fas fa-file-invoice-dollar"></i> 账单管理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/anomalies"><i class="fas fa-exclamation-triangle"></i> 异常记录</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/water_plans"><i class="fas fa-project-diagram"></i> 水务规划</a>
                    </li>
                    {% if user and user.role == "admin" %}
                    <li class="nav-item">
                        <a class="nav-link active" href="/admin"><i class="fas fa-user-shield"></i> 管理控制台</a>
                    </li>
                    {% endif %}
                </ul>
                <div class="navbar-nav">
                    <span class="nav-item nav-link">
                        <i class="fas fa-user"></i> {{ user.username }}
                    </span>
                    <a class="nav-link" href="/logout"><i class="fas fa-sign-out-alt"></i> 退出登录</a>
                </div>
            </div>
        </div>
    </nav>

    <div class="container py-4">
        {% if error %}
        <div class="alert alert-danger alert-dismissible fade show" role="alert">
            {{ error }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
        {% endif %}

        {% if success %}
        <div class="alert alert-success alert-dismissible fade show" role="alert">
            {{ success }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
        {% endif %}

        <div class="row mb-4">
            <div class="col-md-12">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="/admin">管理控制台</a></li>
                        <li class="breadcrumb-item active" aria-current="page">待审核账单</li>
                    </ol>
                </nav>
                <div class="d-flex justify-content-between align-items-center">
                    <h2><i class="fas fa-tasks"></i> 待审核账单</h2>
                    <a href="/admin" class="btn btn-secondary">
                        <i class="fas fa-arrow-left"></i> 返回管理控制台
                    </a>
                </div>
            </div>
        </div>

        <div class="card shadow-sm mb-4">
            <div class="card-header bg-light">
                <h3 class="card-title mb-0"><i class="fas fa-list"></i> 待审核账单列表</h3>
            </div>
            <div class="card-body">
                {% if bills %}
                <div class="table-container">
                    <table class="custom-table">
                        <thead>
                            <tr>
                                <th>账单ID</th>
                                <th>用户ID</th>
                                <th>水表编码</th>
                                <th>起始读数</th>
                                <th>结束读数</th>
                                <th>用水量(m³)</th>
                                <th>金额(元)</th>
                                <th>生成日期</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for bill in bills %}
                            <tr>
                                <td>{{ bill.id }}</td>
                                <td>{{ bill.user_id }}</td>
                                <td>{{ bill.meter_code }}</td>
                                <td>{{ bill.start_reading }}</td>
                                <td>{{ bill.end_reading }}</td>
                                <td>{{ bill.water_usage }}</td>
                                <td>{{ bill.amount }}</td>
                                <td>{{ bill.bill_date }}</td>
                                <td class="actions">
                                    <a href="/admin/review_bill/{{ bill.id }}" class="btn btn-sm btn-info">
                                        <i class="fas fa-eye"></i> 审核
                                    </a>
                                </td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
                {% else %}
                <div class="alert alert-info">
                    <i class="fas fa-info-circle"></i> 暂无待审核账单
                </div>
                {% endif %}
            </div>
        </div>
    </div>

    <footer class="footer">
        <div class="container">
            <p>&copy; 2023 智能水表抄表系统 | 提供水表读数和编码识别</p>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
        crossorigin="anonymous"></script>
</body>

</html> 